# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=picat
pkgver=3.7
_pkgver="${pkgver//./}"
pkgrel=0
pkgdesc="Logic-based multi-paradigm programming language"
url="http://picat-lang.org/"
arch="all"
license="MPL-2.0"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::http://picat-lang.org/download/picat${_pkgver}_src.tar.gz
	fix-fileno-usage.patch
	use-time_t.patch
	"
builddir="$srcdir/Picat/emu"

build() {
	make -f Makefile.linux64
}

check() {
	./picat --version
}

package() {
	local extdir="$srcdir"/Picat

	install -Dvm755 picat -t "$pkgdir"/usr/bin/

	install -Dvm644 "$extdir"/lib/* \
		-t "$pkgdir"/usr/lib/$pkgname

	install -Dvm644 "$extdir"/README \
		"$extdir"/LICENSE "$extdir"/doc/* \
		-t "$pkgdir"/usr/share/doc/$pkgname

	cp -va "$extdir"/exs \
		"$pkgdir"/usr/share/doc/$pkgname/examples
}

sha512sums="
a0a6af15e4fa91aa6e75f2d3c6f3216fd0c5705127e5acc6588677d06a5e4dbe3c99577715ca0e5f793825f22fef97d6dc40bf9fd347b8eebb6c0864bc8a2666  picat-3.7.tar.gz
2dba3365496fd363159adae5a320ee876475bdc02d04b4edb18ceb4bc5fffb5a145ad9bc07c6c17e928e50fa57b6324feb3993a751a1647542a55baf054f1cdf  fix-fileno-usage.patch
e030ffd5014d99b76d215f6d18c5136f3330eefb623253ee41b0f4122323050fd3b0ae5e300d04162dc4d6f6f27907bb78f703ff382d7a56f4c55e74f1c6b573  use-time_t.patch
"
